package cn.itcast.mq.config;

import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 消息持久化
 *      交换机持久化
 *      队列持久化
 *      消息持久化
 */
@Configuration
public class CommonConfig {
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("simple.direct",true,false);
    }

    @Bean
    public Queue simpleQueue(){
        //return new Queue("simple.queue");
        return QueueBuilder.durable("simple.queue").build();
    }

}
